﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using A2DFramework.EventService.Configuration;
using System.Threading;
using A2DFramework.EventService.Factory;
using A2DFramework.EventService.SuperSocket.Core;

namespace A2DFramework.EventService.Providers
{
    public class SuperSocketEventBusProvider : IEventBusProvider
    {
        public void Publish(IEvent evt)
        {
            using (var client = A2DSocketFactory.GetA2DSocketClient())
            {
                client.Send(Helper.GeneratePublishCommand(evt));
            }
        }


        public void Subscribe(string evtClassType)
        {
            using (var client = A2DSocketFactory.GetA2DSocketClient())
            {
                client.Send(Helper.GenerateSubscribeCommand(evtClassType));
            }
        }
    }
}
